<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>myproject</title>
</head>

<body>

    <div>这是一个默认的文本</div>
    <img src="00.png" title="默认的图片">

    <script>
        var div = document.querySelector('div');
        var img = document.querySelector('img');
        var date = new Date();
        var h = date.getHours();

        if (h < 12) {
            div.innerHTML = '上午上午';
            img.src = "01.png";
            img.title = "上午";
        } else if (h < 18 && h > 11) {
            div.innerHTML = '下午下午';
            img.src = "02.png";
            img.title = "上午";
        } else {
            div.innerHTML = '晚上晚上';
            img.src = "03.png";
            img.title = "上午";
        }
    </script>
</body>

</html>